import tkinter as tk

# 创建主窗口
root = tk.Tk()
root.title("数字排序课程")
root.geometry("600x400")

# 输入框
entry_label = tk.Label(root, text="请输入数字，用空格分隔:")
entry_label.pack(pady=10)
entry = tk.Entry(root)
entry.pack(pady=10)

# 按钮框架，用于更好地组织排序按钮
lecture_button_frame = tk.Frame(root)
lecture_button_frame.pack(pady=10)

# 存储按钮
buttons = []

# 课程按钮
for i in range(1, 7):
    row = (i - 1) // 3 + 2  # 计算行号，从第3行开始，每3个按钮换一行
    col = (i - 1) % 3
    if i == 1:
        text = f"冒泡排序（从小到大）"
        button = tk.Button(lecture_button_frame, text=text,
                         width=20, height=1)
    elif i == 2:
        text = f"选择排序（从小到大）"
        button = tk.Button(lecture_button_frame, text=text,
                         width=20, height=1)
    elif i == 3:
        text = f"插入排序（从小到大）"
        button = tk.Button(lecture_button_frame, text=text,
                         width=20, height=1)
    elif i == 4:
        text = f"冒泡排序（从大到小）"
        button = tk.Button(lecture_button_frame, text=text,
                         width=20, height=1)
    elif i == 5:
        text = f"选择排序（从大到小）"
        button = tk.Button(lecture_button_frame, text=text,
                         width=20, height=1)
    elif i == 6:
        text = f"插入排序（从大到小）"
        button = tk.Button(lecture_button_frame, text=text,
                         width=20, height=1)
    button.grid(row=row, column=col, padx=5, pady=5)
    buttons.append(button)

# 输出标签
output_label = tk.Label(root, text="")
output_label.pack(pady=10)

# 运行主界面
root.mainloop()